import {post, get, DCAPI} from "libs/api"

const ANALYSIS = `${DCAPI}analysis/`
const ADD_ROOT = `${DCAPI}scheme/`
export function getByProjectId (id) {
  return get(`${ANALYSIS}getAnalysisProjectByUserId/${id}`)
}
// 数据分析列表
export function getAnalysisList (query) {
  return post(`${ANALYSIS}analysisTaskQuery`, JSON.stringify(query))
}

// 更改公开状态
export function updateStatus (id) {
  return post(`${ANALYSIS}updateAnalysisPublicOrPrivate/${id}`)
}
// 重命名
export function renameDataAnalysis (params) {
  return post(`${ANALYSIS}resetTaskName`, JSON.stringify(params))
}
// 详情
export function getAnalysisInfo (query) {
  return get(`${ANALYSIS}getAnalysisById/${query.id}`)
}
// 新增
export function addAnalysis (url, query) {
  return post(`${ADD_ROOT + url}`, JSON.stringify(query))
}
// 获取区域表
export function getArea () {
  return get(`${DCAPI}location/getAllLocationInfo`)
}
// 删除数据分析
export function delAnalysis (query) {
  return get(`${ANALYSIS}deleteAnalysisById/${query.id}`)
}
